package tjs.study.notes.dotest.jdk.thread;


import java.util.concurrent.TimeUnit;

/**
 * Created by Nicky.Tang on 2021/11/16 5:16 下午
 *
 * @since 02.12.10
 */
public class DoTestOfDaemo {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            while (true){
                try {
                    TimeUnit.SECONDS.sleep(1);
                    System.out.println("running..");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        thread.setDaemon(false);
        thread.start();
        TimeUnit.SECONDS.sleep(2);
        System.out.println("stop..");
    }
}
